package com.kly.cashmall.widget.refresh;


import com.scwang.smart.refresh.layout.api.RefreshLayout;

/**
 * @author chenwei
 * @date 2018/7/11
 */
public class RefreshStatusListener implements StatusListener {

  private RefreshLayout refreshLayout;
  private RefreshStatus refreshStatus;

  public RefreshStatusListener(RefreshLayout refreshLayout, RefreshStatus refreshStatus) {
    this.refreshLayout = refreshLayout;
    this.refreshStatus = refreshStatus;
  }

  @Override
  public void onStart() {

  }

  @Override
  public void onEnd() {
    if (refreshLayout != null) {
      if (refreshStatus == RefreshStatus.REFRESH_DATA) {
        refreshLayout.finishRefresh();
      } else {
        refreshLayout.finishLoadMore(10);
      }
    }
  }
}
